const path = require('path')
const SkeletonWebpackPlugin = require('vue-skeleton-webpack-plugin')

function resolve(dir) {
  return path.join(__dirname, dir)
}

module.exports = {
  publicPath: process.env.NODE_ENV === 'production' ? '/' : '/',
  lintOnSave: true,
  productionSourceMap: false,
  configureWebpack: config => {
    if (process.env.NODE_ENV === 'production') {
      // 为生产环境修改配置...
    } else {
      // 为开发环境修改配置...
    }
  },
  chainWebpack: config => {
    // 代码地址压缩优化
    config.optimization.concatenateModules(true)
    config.plugin('skeleton').use(SkeletonWebpackPlugin, [
      {
        webpackConfig: {
          entry: {
            app: resolve('./src/entry-skeleton.js'),
          },
        },
        minimize: true,
        quiet: true
      },
    ])
  },
}
